//% color="#4169E1" iconWidth=50 iconHeight=40
namespace AnalogVoltage{

    //% block="模拟电压检测模块[OBJ]初始化 引脚[PIN]" blockType="command" 
    //% OBJ.shadow="normal" OBJ.defl="voltage1"
    //% PIN.shadow="normal" PIN.defl="pin1"
    export function AnalogVoltageInit(parameter: any, block: any) {
        let obj=parameter.OBJ.code;
        let pin=parameter.PIN.code;
        Generator.addImport("from dfrobot_analog_voltage import AnalogVoltage");
        Generator.addCode(`${obj} = AnalogVoltage(${pin})`);
   
    }


    //% block="[OBJ]读取模拟电压检测模块数据(V)" blockType="reporter"  
    //% OBJ.shadow="normal" OBJ.defl="voltage1"
    export function AnalogVoltage_read_data(parameter: any, block: any) { 
        let obj=parameter.OBJ.code;
        Generator.addCode( [`${obj}.read_voltage()`,Generator.ORDER_UNARY_POSTFIX]);
   
   }

   
}